package com.prnasia.cloud.spring.pcom.feign.fallback;

import com.prnasia.cloud.spring.entity.StoryEntity;
import com.prnasia.cloud.spring.pcom.feign.StoryFeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 实现的方法是服务调用的降级方法
 * Created by Wen Gao on 2019/4/8.
 */
@Component
public class StoryFeignFallBack implements StoryFeignClient {

    @Override
    public StoryEntity get(@PathVariable("id") int id) {
        return new StoryEntity(0, "default fallback headline");
    }

    @Override
    public StoryEntity add(@RequestBody StoryEntity story) {
        return new StoryEntity(0, "default fallback headline");
    }

}
